208A - Dubstep - CodeForces Solution


strings *900

Please click on ads to support us..

Python Code:

dub = str(input())
title = dub.split("WUB")

for i in title:
  if i != "":
    print(i, end = " ")
  

C++ Code:

/* 
:::::::
.
AUTHOR :- rk.ttps25 
.
:::::::
*/
 
//**************** INCLUDE ****************************************************//
 
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <iomanip>
#include <map>
#include <list>
#include <random>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <tuple>
#include <vector>
#include <map>
#include <fstream>
 
using namespace std;
 
//**************** TYPEDEF *****************************************************//
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
//**************** TEMPLATE ****************************************************//
 
template <class T>
T maxim(T x,T y){
    return x>y?x:y;
}
template <class T>
T minim(T x,T y){
    return x>y?y:x;
}
 
//**************** DEFINE ******************************************************//
 
#define fi                   first
#define se                   second
#define pb                   push_back
#define mp                   make_pair
#define endl                 '\n'
#define all(x)               (x).begin(), (x).end()
#define fr(i,a,b)            for(int i = a; i < b; i++)
#define rep(i,a,b)           for(ll i = a; i < b; i++)
#define repr(i,a,b)          for(ll i = b-1; i >= a; i--)
#define MOD                  1000000007                               
#define MOD1                 998244353                               
#define si                   set <int>
#define vi                   vector <int>
#define vl                   vector <ll>
#define pii                  pair <int, int>
#define pll                  pair <ll, ll>
#define vpii                 vector <pii>
#define vpll                 vector <pll>
#define mii                  map <int, int>
#define mpi                  map <pii, int>
#define mll                  map <ll, ll>
#define min3(a, b, c)        min(c, min(a, b))
#define min4(a, b, c, d)     min(d, min(c, min(a, b)))
#define input(x)             ll x; cin >> x
 
 
#define fast_cin()                      \
    ios_base::sync_with_stdio(false);   \
    cin.tie(nullptr);                   \
    cout.tie(nullptr)                                  
                                      
//**************** FUNCTION ******************************************************//

int gcd(int a,int b){
    while(a!=b){
        if(a>b) a=a-b;
        else b=b-a;
    }
    return a;
}

void judge(){
    #ifndef ONLINE_JUDGE
	freopen("input.txt",  "r",  stdin);
	freopen("Error.txt","w",stderr);
	freopen("output.txt", "w", stdout);
    #endif
    
}
 
/* ASCII VALUE
A=65,Z=90
a=97,z=122
0=48,9=57
*/
void solve(){
    string s;
    ll c=1;
    cin>>s;
    for(ll i=0;i<s.size();){
        if(s[i]=='W' && s[i+1]=='U' && s[i+2]=='B'){
            i+=3;
            if(!c){
                cout<<" ";
            }
            continue;
        }
        else
        {
            c=0;
            cout<<s[i];
            i+=1;
        }
    }
}    
 
/* ...................MAIN.......................*/
 
signed main() {
    
    fast_cin();     
    judge(); 
    
	int rk=1;
	//cin>>rk;
    while(rk--){
	    solve();
	}
	
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	
	return 0;
	
}
// THE END**********************
 
/*
.
.
*/


Comments

Submit
0 Comments
More Questions

2144. Minimum Cost of Buying Candies With Discount
Non empty subsets
1630A - And Matching
1630B - Range and Partition
1630C - Paint the Middle
1630D - Flipping Range
1328A - Divisibility Problem
339A - Helpful Maths
4A - Watermelon
476A - Dreamoon and Stairs
1409A - Yet Another Two Integers Problem
977A - Wrong Subtraction
263A - Beautiful Matrix
180C - Letter
151A - Soft Drinking
1352A - Sum of Round Numbers
281A - Word Capitalization
1646A - Square Counting
266A - Stones on the Table
61A - Ultra-Fast Mathematician
148A - Insomnia cure
1650A - Deletions of Two Adjacent Letters
1512A - Spy Detected
282A - Bit++
69A - Young Physicist
1651A - Playoff
734A - Anton and Danik
1300B - Assigning to Classes
1647A - Madoka and Math Dad
710A - King Moves